#ifndef UModelViewerH
#define UModelViewerH

/** This will hold a simple model viewer / tester application **/
/* Design goals:
 *  - Allow easy viewing and manipulating of model
 *  - Quickly test new engine code on models and vice-versa
 *
 * Think of things like viewing a new model to see how it will look ingame,
 * or testing the animation, collision and IK code
 *
 * +++ Will support lots of shortcuts :) +++
 */

#include "UCustomWindow.h"
#include "UModel.h"
#include "UVector.h"
#include "UGLFont.h"
#include "UCamera.h"
#include "UArcBall.h"
#include <boost/shared_ptr.hpp>

class TModelViewer : public TCustomWindow	{ //It's a window, but we don't name it that
private:
	boost::shared_ptr<TModel>   model; //The model we are viewing (for now only one per window)
	boost::shared_ptr<TArcBall> arcball;
	bool autoRotate; //ArcBall release while dragging
	GLfloat scale;

	bool lighting, wireframe, rotatingModel, orthoMode;
	GLuint shadeModel;
	int windowWidth, windowHeight;
	int mx, my, oldmx, oldmy, mdx, mdy;

	//FIXME: Should use ArcBall rotation ftw
	TCamera camera;
	TVector lightPos;
	TVector modelPos;
	TVector modelRot;
	TGLFontRef fnt;
public:
	TModelViewer(TModel* mdl);
	void Draw();
	void MouseMove	(int X, int Y, int mstate); //FIXME: Why is there still no good mouse frame work?
	void MouseUp(int X, int Y, uint8 button) ;
	void MouseDown	(int X, int Y, uint8 button);
	void KeyDown(SDL_KeyboardEvent* Key);
	void resize(int w, int h); //For knowing our own width and hight
};

#endif
